<!--conf
<sample in_favorites="false">
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Import/export from/to CSV</title>
	
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>
<body>
	<h1>Import/export from/to CSV</h1>
	
	<script>
		function serilaizeToCSVWithDelim(delim){
			mygrid.setCSVDelimiter(delim)
			document.getElementById('ser_1').value=mygrid.serializeToCSV();
		}
	</script>
	<table width="800" cellspacing="0" cellpadding="0">
		<tr>
			<td valign="top">
				<div id="gridbox" style="width:600px; height:270px; background-color:white;"></div>
			</td>
		</tr>
		<tr>
			<td valign="top" width="400px">
				<p>Serialization to CVS is possible in dhtmlxGrid. You can choose which delimiter to use.</p>
					Use as delimiter:<br>
					<li hrei><a href="javascript:void(0)" onClick="serilaizeToCSVWithDelim('\t')">Tab</a> - \t</li>
					<li><a href="javascript:void(0)" onClick="serilaizeToCSVWithDelim(',')">Comma</a> - ,</li>
					<li><a href="javascript:void(0)" onClick="serilaizeToCSVWithDelim(document.getElementById('serdelim').value)">Other</a> <input id="serdelim" size="1" maxlength="1"></li>
				
				<p>Load from CSV</p>
					<li><a href="javascript:void(0)" onClick="mygrid.clearAll();mygrid.loadCSVString(document.getElementById('ser_1').value)">Load Grid from CSV (content of textarea below)</a></li>
			
			</td>
		</tr>
	</table>
	<textarea style="font-size:8pt; font-family:Arial; width:800px; height:150px;" id="ser_1"></textarea>
<br>


<script>

   mygrid = new dhtmlXGridObject('gridbox');
   mygrid.setImagePath("../../../codebase/imgs/");
   mygrid.setHeader("Sales,Book Title,Author,Price,In Store,Shipping,Bestseller,Date of Publication");
   mygrid.setInitWidths("50,150,100,80,80,80,80,200")
   mygrid.setColAlign("right,left,left,right,center,left,center,center")
   mygrid.setColTypes("dyn,ed,ed,price,ch,co,ra,ro");
   mygrid.getCombo(5).put(2,2);
   mygrid.init();
   mygrid.setSkin("dhx_skyblue")
	mygrid.enableCSVAutoID(false)
   mygrid.loadCSVFile("../common/grid.csv");
	
	
</script>

</body>
</html>
